<?
class session {
  protected $sSessionID;
  function __construct($sName="dshield") {
    session_name($sName);
    session_start();
    $sSessionID=session_id();
  }
  function __destruct() {
    session_write_close();
  }
  function get($sName,$sValid='ctype_alnum') {
    if (isset($_SESSION[$sName])) {
      if ( call_user_func($sValid,$_SESSION[$sName])) {
        return $_SESSION[$sName];
      }
    }
  }
  function set($sName,$sValue) {
    $_SESSION[$sName]=$sValue;
  }
  function logout() {
    $_SESSION['id']='';
  }
}
